'////////////////////////////////////////////////////////////////////////////////////////////////
'    Project:  Remove Inbox Games from Windows Client
'    Website:  http://scriptsforwindows.codeplex.com/
'  File Name:  Remove-Inbox-Games.vbs
'    Created:  01/06/2009
'   Modified:  01/06/2009
'     Author:  Andrew Willett
'    Website:  http://www.andrewwillett.com/
'    License:  Microsoft Public License (Ms-PL)
'              http://www.opensource.org/licenses/ms-pl.html
'              Open Source Software
'              The above license governs use of the this software. 
'              If you use the software, you accept this license. 
'              If you do not accept the license, do not use the software.
'              This notice must not be removed.
'   Supports:  Windows XP
'              Windows Server 2003
'              Windows Server 2003 R2
'              Windows Vista
'              Windows Server 2008
'              Windows 7
'              Windows Server 2008 R2
'/////////////////////////////////////////////////////////////////////////////////////////////////

'Explit mode
Option Explicit

'Detect Windows Operating System Version
Dim ntver, comspec
comspec = CreateObject("Wscript.Shell").Exec("%comspec%").StdOut.ReadLine
If (Mid(comspec,1,20)="Microsoft Windows XP") Then 
	ntver = Mid(comspec,31,(Len(comspec)-31))
ElseIf (Mid(comspec,1,22)="Microsoft Windows 2000") Then 
	ntver = Mid(comspec,33,(Len(comspec)-33))
Else 
	ntver = Mid(comspec,28,(Len(comspec)-28))
End If

'Windows NT 5.1/5.2
If (Mid(ntver,1,3)="5.1") Or (Mid(ntver,1,3)="5.2") Then
	Dim fso, file
	Set fso = CreateObject("Scripting.FileSystemObject")
	Set file = fso.CreateTextFile("c:\windows\temp\sysocmgr.txt", True)
	file.WriteLine("[components]")
	file.WriteLine("freecell=off")
	file.WriteLine("hearts=off")
	file.WriteLine("minesweeper=off")
	file.WriteLine("pinball=off")
	file.WriteLine("solitaire=off")
	file.WriteLine("spider=off")
	file.WriteLine("zonegames=off")
	file.Close
	CreateObject("Wscript.Shell").Exec("sysocmgr /i:c:\windows\inf\sysoc.inf /u:c:\windows\temp\sysocmgr.txt /q /r")
End If

'Windows NT 6 Series
If (Mid(ntver,1,2)="6.") Then
	CreateObject("Wscript.Shell").Exec("pkgmgr /uu:InboxGames")
End If